import axios from 'axios'

const FileManager = {
  path:process.env.BASE_URL + "post/",
  getAllTopic : function(){
    return [
        "第一卷",
        "第二卷"
        
    ]
  },
  getPosts : function(topic){
    switch(topic){
        case 0:
            return ["中国社会各阶级的分析","湖南农民运动考察报告"]
        case 1:
            return ["反对日本进攻的方针、办法和前途","为动员一切力量争取抗战胜利而斗争"]            
    }
  },
  getPostContent: function(topicName,postName){
    let url = this.path + topicName + '/' + postName + '.md'
    return new Promise((res,rej)=>{
        axios.get(url).then((response)=>{
            //console.log(response.data)
            res(response)
        },rej)
    })
  }
}

export default FileManager
